<?php

namespace app\common\model;

use think\Model;
use think\Hook;
use Carbon\Carbon;
use think\Exception;
use app\common\traits\model\TraitModel;
/**
 * 支付事务处理模型类
 */
class PaymentTransaction extends Model
{
    protected $autoWriteTimestamp = 'datetime';
    protected $createTime         = 'created_at';
    protected $updateTime         = 'updated_at';
    protected $table              = 'payment_transactions';

    use TraitModel;

    public function logs($user_id, $number = '', $payment_logs_info = [])
    {
        foreach ($payment_logs_info as $k => $payment_log_info) {
            $infos[] = ['user_id' => $user_id, 'type' => $k, 'price' => $payment_log_info['price'], 'status' => $payment_log_info['status'], 'number' => $number];
        }
    	return $this->saveAll($infos);
    }

    /**
     * 支付回滚
     * @param  string $value [description]
     * @return [type]        [description]
     */
    public function payRollback($user_id, $number)
    {
    	# code...
    }
}
